home *** CD-ROM | disk | FTP | other *** search
- %OP%VS4.11 (04-Dec-91), Gerald Lewis Fitton, R4000 5065 0380 9644
- %OP%DP0
- %OP%IRY
- %OP%PL0
- %OP%HM0
- %OP%FM0
- %OP%BM0
- %OP%LM4
- %OP%FX
- %OP%FY
- %OP%FS
- %OP%PT1
- %OP%PDPipeLine
- %OP%WC834,2070,164,1620,0,0,0,0
- %CO:A,72,72%
- %C%The Trend Function
- %C%by Gerald L Fitton
- Keywords:
- Trend Linest Transpose Set_Value Fitton
-
- The Trend(,) function
- Some of you have had problems understanding Trend(,) in the PD4
- reference manual. The syntax for this function is correctly given as
- Trend(Linest,x_data) but you are not told the nature of the arguments.
- Linest is a row vector such as {1,2} representing the line y = 2x + 1;
- in its most general form, Linest is {c,m} and its arguments are the c
- and m of the straight line y = mx + c. The second argument of Trend(,)
- which I have called x_data, is a row vector of values of x. The
- function Trend(,) returns a row vector 'hidden' in the one slot
- containing the values of y returned by the formula y = mx + c for the
- corresponding values of x.
-
- The problem most of you have had is that you have used a column of data
- for the x values and Trend(,) will not accept a column vector for the
- x_data argument. The easiest way around this problem is to use the
- function Transpose(). For example if the x data is in the column A3A9
- then Trend({1,2},Transpose(A3A9)) will return a row vector with the
- values of y corresponding to y = 2x + 1.
-
- As a final example, suppose you have x data in A3A9, the corresponding
- scattergraph y data in B3B9 and you want to output into C3C9 the values
- of y on the line of best fit corresponding to the range A3A9 of x data.
- To do this you enter the following rather long function in slot C3:
-
- set_value(C3C9,transpose(trend(linest(B3B9,A3A9),transpose(A3A9))))
-
- I have included a simple example which includes this formula on the
- Archive monthly disc. By the way, in column D I have calculated the
- variances and in slot D11 I have used array multiplication to find the
- residual sum of squares using the formula Sum(D3D9*D3D9). Please let
- me know how you get on!
-